package com.spring.hotel.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.spring.hotel.common.JsonResponse;
import com.spring.hotel.entity.Employee;
import com.spring.hotel.entity.Member;
import com.spring.hotel.entity.PageDTO;
import com.spring.hotel.mapper.MemberMapper;
import org.springframework.stereotype.Service;

@Service
public class MemberService extends ServiceImpl<MemberMapper, Member> {
    public JsonResponse pageList(Member member, PageDTO pageDTO) {
        QueryWrapper<Member> queryWrapper = new QueryWrapper<>();
        if (member.getId() != null) {
            queryWrapper.lambda().like(Member::getId, member.getId());
        }
        Page<Member> page = this.page(new Page<>(pageDTO.getPageNum(), pageDTO.getPageSize()), queryWrapper);
        return JsonResponse.success(page);
    }
}
